<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>JspSort</title>
		<script type="text/javascript">
			window.onload = function(){
				document.getElementById("form").onsubmit=function(){
					var form=document.getElementById("form");
					var iderrormsg = document.getElementById("iderrormsg");
					var regex = /^(-?\d+,)+(-?\d+)$/;
					var words=form.words.value;
					if(!regex.test(words)){
						iderrormsg.textContent="请输入需要排序的内容，并以逗号隔开！";
						return false;
					}
					iderrormsg.textContent="";
					return true;
				};
			};
		</script>
	</head>
	<body>
		<jsp:include page="/jspdemo/header.jsp" />
		${sortedResult }
		<form id="form" action="/test/infoOperateServlet?infooperate=stringsort" method="post">
			<input type="text" maxlength="50" name="words"/>
			<select name="sortkind">
				<option value="asc">升序</option>
				<option value="dec">降序</option>
			</select>
			<input type="submit" value="提交"/>
		</form>
		<br><label id="iderrormsg" style="color:red"></label>
	</body>
</html>